package com.wzb.consumer.controller;


import com.wzb.service.EveningService;
import com.wzb.service.GoodNightService;
import com.wzb.service.HelloService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import javax.annotation.Resource;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


@Component
public class TestController {

    @Reference(version = "1.0.0")
    private HelloService helloService;

    @Reference(version = "1.0.0")
    private GoodNightService goodNightService;

    @Reference(version = "1.0.0")
    private EveningService eveningService;



    public void run(){
        ExecutorService service = Executors.newFixedThreadPool(3);
        while(true){
            service.execute(new Runnable() {
                @Override
                public void run() {
                    helloService.sayHello();
                }
            });
            service.execute(new Runnable() {
                @Override
                public void run() {
                    goodNightService.goodNight();
                }
            });
            service.execute(new Runnable() {
                @Override
                public void run() {
                    eveningService.Evening();
                }
            });
        }



    }


}
